package Test;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

public class SocketTest {
    public static void main(String[] args) {

        try {
            Socket s = new Socket("localhost", 8888);
            InputStream in = s.getInputStream();
            OutputStream out = s.getOutputStream();
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            PrintWriter pw = new PrintWriter(out, true);
            Scanner input = new Scanner(System.in);
            System.out.println("请输入你要查找的选项：");
            String uesr = input.next();
            pw.println(uesr);
            String reply=null;
            while ((reply= br.readLine())!=null){
                System.out.println("服务器："+reply);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
